#ifndef __LOG_UTIL_H__  
#define __LOG_UTIL_H__  

typedef enum
{
	LEVEL_NONE = 0, /* 不输出日志 */
	LEVEL_DEBUG,
	LEVEL_INFO,
	LEVEL_WARNING,
	LEVEL_ERROR
} LEVEL_TYPE;

const char LOG_TYPE[5][10] = {
	"",
	"Debug",
	"Info",
	"Warning",
	"Error"
};


/* 配置文件中的配置项 */
const char LOG_CONFIG_SECTION[] = "LOG";
const char LOG_CONFIG_LEVELTYPE[] = "LEVELTYPE"; // 打印日志的等级  
const char LOG_CONFIG_FILENAME[10] = "log.txt"; // 默认日志文件名  
const char LOG_DIRNAME[32] = "log"; //日志文件夹  
#define LOG_ENABLE false

#include "cocos2d.h"
#include <sys/stat.h>

using namespace cocos2d;
using namespace std;

#define LOG_TO_FILE(__content__) LogUtil::getInstance()->log(__content__);

class LogUtil : public cocos2d::Ref {

public:
	static LogUtil* getInstance();
	void log(const char* pContent);

private:
	void init();
	std::string combine(const char* content);
	std::string getCurrentDate();
	std::string getCurrentTime();
	bool saveFile(const char* pContent, std::string path, std::string fileName);
	bool logFileCheck(const char* fileName);
};
#endif /* defined(__MyCocos__LogUtil__) */ 